﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;

namespace Postnuclear.Collections
  {
  /// <summary>
  /// Notifies listeners of dynamic changes, such as when items get added, removed or the whole list is refreshed.
  /// </summary>
  /// <typeparam name="T">The type of the elements in the collection.</typeparam>
  public interface INotifyCollectionChanged<T>
    : INotifyCollectionChanged, INotifyPropertyChanged
    {
    // Events

    /// <summary>
    /// Occurs when collection is cleared.
    /// List of items that were cleared from collection is passed as arguments value.
    /// </summary>
    event EventHandler<ValueEventArgs<IEnumerable<T>>> CollectionCleared;

    /// <summary>
    /// Occurs when new item is added to collection.
    /// Added item is passed as arguments value.
    /// </summary>
    event EventHandler<ObservableItemEventArgs<T>> ItemAdded;

    /// <summary>
    /// Occurs when item is removed from collection.
    /// Removed item is passed as arguments value.
    /// </summary>
    event EventHandler<ObservableItemEventArgs<T>> ItemRemoved;
    }
  }